{% extends base.html %}

{% block title %}{{ options.site_name }} - 后台管理 - 迅雷离线下载分享{% end %}

{% block head %}
<style>
dd { font-weight: bold; margin-bottom: 5px; margin-left: 20px; }
ul { list-style-type: disc; padding-left: 30px; }
hr { margin-top: 10px; margin-bottom: 20px; }
.message { margin: 5px 0; color: red; font-weight: bold; font-size: 200%; }
</style>  
{% end %}

{% block body %}
<div class="message"><pre>{{ message }}</pre></div>
<section id="status">
  <dl>
    <dt>当前迅雷用户</dt>
    <dd>{{ handler.task_manager.username }} - {{ handler.task_manager._xunlei.uid }} - 
    <a href="/manager/recheck_login">{{ "已登录" if handler.task_manager.islogin else "未登录" }}</a></dd>

    {% if not handler.vip_pool.pool %}
      <dt>当前uid</dt>
      <dd>{{ handler.task_manager.uid }}</dt>

      <dt>当前task_id</dt>
      <dd>{{ handler.task_manager.last_task_id }}</dt>

      <dt>当前gdriveid</dt>
      <dd>{{ handler.task_manager.gdriveid }}</dt>
    {% else %}
      <dt>VIPool<dt>
      <dd>size: {{ len(handler.vip_pool.pool) }}</dd>
    {% end %}

    <dt>logging level</dt>
    <dd><a href="/manager/switch_level">{{ handler.logging_level }}</a></dd>
  </dl>
</section>
<hr />
<section id="options">
  <ul>
      <li><form action="/manager/flush_mem_cache" method="POST"><button type="submit">刷新缓存</button></form></li>
      <li>重新抓取 <form action="/manager/refetch_finished_tasks" method="POST"><button type="submit">所有</button></form> / <form action="/manager/refetch_downloading_tasks" method><button>下载中</button></form> 的任务</li>
      <li>
        <dl>
          <dt>
            <form action="/manager/set_tid" method="POST">设置task_id: 
              <input name="tid" type="text" value="{{ handler.task_manager.last_task_id }}" />
              <input type="submit" value="submit" />
            </form>
          </dt>
          <dd>
            <ul>
              {% for tid in handler.task_manager.task_id_sample %}
              <li><a href="/manager/set_tid?tid={{ tid }}">{{ tid }}</a></li>
              {% end %}
              <li><a href="/manager/clear_tid_sample">清除task_id记录</a></li>
            </ul>
          </dd>
      </li>
      <li>
        <form action="/manager/get_user_email">Get Email: 
          <input name="user_id" type="text" /><input type="submit" value="submit" />
        </form>
      </li>
      <li>
        <form action="/manager/block_user" method="POST">Block: 
          <input name="user_id" type="text" /><input type="submit" value="submit" />
        </form>
      </li>
      <li><a href="/manager/get_add_task_limit">查看添加任务计数</a></li>
      <li><a href="/manager/get_reload_limit">查看reload计数</a></li>
      <li><form action="/manager/reset_limit" method="POST"><button type="submit">重置任务计数器计数</button></form></li>
  </ul>
</section>
{% end %}
